<?php
/**
 * +----------------------------------------------------------------------
 * | summer framework
 * +----------------------------------------------------------------------
 * | Copyright (c) 2020 https://github.com/suframe/think-admin All rights reserved.
 * +----------------------------------------------------------------------
 * | Author: summer <806115620@qq.com>  2020/4/16 13:55
 * +----------------------------------------------------------------------
 */

namespace app\mall\enum;

use \app\mall\enum\OrderAdminOpsEnum as adminOps;
use \app\mall\enum\OrderUserOpsEnum as usernOps;

class OrderRefundEnum extends Base
{

    public const NO = 1;
    public const YES = 2;
    public const REFUSE = 3;
    public const COMPLETED = 4;


    public static function toZhArray(): array
    {
        return [
            self::NO => '否',
            self::YES => '是',
            self::REFUSE => '拒绝',
            self::COMPLETED => '已完成退款',
        ];
    }

    public function userCanRefund(): bool
    {
        //未申请退款，或者被拒绝的可以去申请退款
        return in_array($this->getValue(), [
            static::NO,
            static::REFUSE
        ]);
    }

    public function hasRefund(): bool
    {
        //未申请退款，或者被拒绝的可以去申请退款
        return $this->getValue() == static::YES;
    }
}